xtsdk_ros  
This code is confidential  

This ROS package supports ROS1 Melodic and ROS2 Foxy versions.  
The ROS functionality of Xintan is based on xtsdk_cpp, see the readme.md document in the xtsdk_cpp subdirectory for more details.  

ROS Version Selection:  
Copy xtsdk_ros to the src directory of your workspace.  
Enter the xtsdk_ros directory.  
Run the following commands:  
chmod +x selros.sh  
./selros.sh 1 to select ROS1 version  
./selros.sh 2 to select ROS2 version  

IP Address Modification:  
Please set and modify the default connection IP address.  

For ROS1, modify the IP address in the cfg/xtsdk_ros1.cfg file:  
gen.add("connect_address", str_t, 0, "connect address ip/serial", "192.168.2.101")  

For ROS2, modify the IP address in the cfg/xtsdk_ros2.yaml file:  
connect_address: 192.168.2.101  

Device Parameter Settings: Maximum Frame Rate, Horizontal Flip Settings:  
In the xtsdk_ros1.cpp or xtsdk_ros2.cpp file, find the code block under the eventCallback function where the device is connected for the first time. This is where you can add your own settings such as filtering, frequency, etc. API reference is available in the readme.md of xtsdk_cpp.  

Build Environment:  
Supports Ubuntu 18.04 or Ubuntu 20.04  
Supports ROS Melodic or ROS2 Foxy  

Dependencies:  
Boost: Configure the CMakeLists.txt file of xtsdk according to your own Boost path.  
OpenCV: Please install the OpenCV library: sudo apt install libopencv-dev  

For ROS1 Compilation:  
Load the ROS1 environment: source /opt/ros/melodic/setup.bash  
Compile with: catkin_make install  

For ROS1 Execution:  
After compiling, source the setup file: source install/setup.bash  
Launch the ROS1 node: roslaunch xtsdk_ros xtsdk_ros1.launch  

For ROS2 Compilation:  
Load the ROS2 environment: source /opt/ros/foxy/setup.bash  
Build with: colcon build  

For ROS2 Execution:  
After compiling, source the setup file: source install/setup.bash  
Launch the ROS2 node: ros2 launch xtsdk_ros xtsdk_ros2.py  

Default Parameter Description:  
For both ROS1 and ROS2, the default configuration is read from the xintan.xtcfg file output by the Windows host. If this configuration file is missing or other parameters are absent, the dynamic parameter files will be used:  
For ROS1, xtsdk_ros1.cfg  
For ROS2, xtsdk_ros2.yaml  

Dynamic Parameter Description:  
image_type: Output from xtsdk  
0: Depth distance image  
1: Depth image + signal amplitude image  
2: Grayscale image  
3: Point cloud output  
4: Point cloud + signal intensity output  
camera/hdr_mode: HDR mode  
0: Off  
1: On  
integration_time_tof_1: Integration time 1, in microseconds, range 0~2000  
integration_time_tof_2: Integration time 2, in microseconds, range 0~2000 (effective only when HDR is enabled)  
integration_time_tof_3: Integration time 3, in microseconds, range 0~2000 (effective only when HDR is enabled)  
integration_time_gray: Grayscale integration time, in microseconds, range 0~20000 (used for measuring ambient light)  
min_amplitude: Minimum valid signal intensity value, in LBS, range 0~1000  
frequency_modulation: TOF frequency adjustment  
0: 12MHz  
1: 6MHz  

Topic Descriptions:  
/xtsdk_ros/xtsdk_node/amplitude_image_raw: Signal amplitude or grayscale image (Image Topic)  
/xtsdk_ros/xtsdk_node/distance_image_raw: Depth image (Image Topic)  
/xtsdk_ros/xtsdk_node/points: Point cloud (Topic)